﻿using System;

namespace Bilibili.Model.Search
{
    public sealed class SearchAnimeItem
    {
        public string type { get; set; }
        public string season_id { get; set; }
        public string media_id { get; set; }
        private string _title;
        public string title
        {
            get => _title;
            set => _title = Uri.UnescapeDataString(value.Replace("<em class=\"keyword\">", string.Empty).Replace("</em>", string.Empty));
        }
        public string areas { get; set; }
        public string cv { get; set; }
        public string styles { get; set; }
        public string desc { get; set; }
        public long pubtime { get; set; }
        public string pubtimeStr
        {
            get
            {
                var start = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
                return start.AddMilliseconds(pubtime).AddHours(8).ToString("yyyy-MM-dd");
            }
        }
        public string season_type_name { get; set; }
        public string cover { get; set; }
        public string angle_title { get; set; }
        public bool showBadge
        {
            get
            {
                return !string.IsNullOrEmpty(angle_title);
            }
        }
    }
}